package com.ysl.fairy_could_class.controller;

import com.ysl.fairy_could_class.domain.Banner;
import com.ysl.fairy_could_class.service.BannerService;
import com.ysl.fairy_could_class.util.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "轮播图管理0508尹世林")
@RequestMapping("/banner")
public class BannerController {

    @Autowired
    BannerService service;

    @GetMapping("/selectById")
    @ApiOperation("根据id查询轮播图0508尹世林")
    public AjaxResult GetResBannerById(Integer id) {
        return AjaxResult.success(service.selectById(id));
    }

    @PostMapping("/addBanner")
    @ApiOperation(value = "新增轮播图0508尹世林")
    public AjaxResult addBanner(@RequestBody Banner banner) {
        return AjaxResult.success(service.SaveBanner(banner));
    }

    @PostMapping("/UpdateBanner")
    @ApiOperation(value = "修改轮播图0508尹世林")
    public AjaxResult UpdateBanner(@RequestBody Banner banner){
        return AjaxResult.success(service.UpdateBanner(banner));
    }

    @PostMapping("/DeleteBanner")
    @ApiOperation(value = "删除轮播图0508尹世林")
    public AjaxResult DeleteBanner(int id) {
        return AjaxResult.success(service.DeleteBanner(id));
    }
}
